import { ApplicationConfig, importProvidersFrom, isDevMode } from '@angular/core';
import { provideRouter, Routes } from '@angular/router';
import { HomeComponent } from './modules/home/home.component';
import { loadRemoteModule } from '@angular-architects/module-federation';
import { provideNzI18n, zh_CN } from 'ng-zorro-antd/i18n';
import { provideAnimations } from '@angular/platform-browser/animations';
import { HttpClientModule } from '@angular/common/http';
import { FormsModule } from '@angular/forms';

const routes: Routes = [
  {path: '', redirectTo: 'home', pathMatch: 'full'},
  {path: 'home', component: HomeComponent},
  {
    path: 'user', loadChildren: () => loadRemoteModule({
      type: 'module',
      remoteEntry: isDevMode() ? 'http://localhost:4201/remoteEntry.js' : '/assets/user/remoteEntry.js',
      exposedModule: './routes',
    }).then(m => m.routes),
  },
];

export const appConfig: ApplicationConfig = {
  providers: [
    provideRouter(routes),
    importProvidersFrom(FormsModule),
    importProvidersFrom(HttpClientModule),
    provideNzI18n(zh_CN),
    provideAnimations(),
  ],
};
